import request from '/@/utils/request'

// 画布数据接口定义
interface Canvas {
  id: number
  name: string
  date: string
  canDelete?: boolean
}

// 创建画布请求参数接口
interface CreateCanvasParams {
  id: number // 必传字段
  name: string
  date: string
}

export const getAntvNode = () => {
  return request({
    url: '/node-properties',
    method: 'get',
  })
}

// 获取画布列表的API方法
export const canvasList = (): Promise<Canvas[]> => {
  return request({
    url: '/drawing/list',
    method: 'get',
  })
}

// 创建画布的API方法
export const createCanvas = (data: CreateCanvasParams) => {
  return request({
    url: '/drawing/create',
    method: 'post',
    data,
  })
}

// 删除画布的API方法
export const deleteCanvas = (data: { id: number }) => {
  return request({
    url: '/drawing/delete',
    method: 'post',
    data,
  })
}

